#define _CRT_SECURE_NO_WARNINGS 1


// 0000000000000000 0x3938
//#include<stdio.h>
//int main()
//{
//    union
//    {
//        short k;
//        char i[2];
//    }*s, a;
//    
//    s = &a;
//    s->i[0] = 0x39;
//    s->i[1] = 0x38;
//    printf(" % x\n", a.k);
//    return 0;
//    
//}
//
//#include <stdio.h>
//union Un
//{
//	short s[7];
//	int n;
//};
//int main()
//{
//	printf("%d\n", sizeof(union Un));
//	return 0;
//}
/*
#include <stdio.h>
int main()
{
	//enum ENUM_A
	//{
	//	X1,
	//	Y1,
	//	Z1 = 255,
	//	A1,
	//	B1,
	//};
	//enum ENUM_A enumA = Y1;//1
	//enum ENUM_A enumB = B1;//257
	//printf("%d %d\n", enumA, enumB);
	
		unsigned char puc[4];
		struct tagPIM
		{
			unsigned char ucPim1;
			unsigned char ucData0 : 1;
			unsigned char ucData1 : 2;
			unsigned char ucData2 : 3;
		}*pstPimData;
		pstPimData = (struct tagPIM*)puc;
		memset(puc, 0, 4);
		pstPimData->ucPim1 = 2;
		pstPimData->ucData0 = 3;
		pstPimData->ucData1 = 4;
		pstPimData->ucData2 = 5;
		printf("%02x %02x %02x %02x\n", puc[0], puc[1], puc[2], puc[3]);
		return 0;//02 
	
}*/
#include <stdio.h>
//struct S1
//
//{
//	char c1;//1
//	int i;//4
//	char c2;//1
//};12
//struct S2
//{
//	char c1;
//	char c2;
//	int i;
//};8
//struct S3
//{
//	double d;
//	char c;
//	int i;
//};//16
//struct S4
//{
//	char c1;//1
//	struct S3 s3;//16
//	double d;
//};
//int main()
//{
//	printf("%d\n", sizeof(struct S4));//32
//}


//struct A
//{
//	int _a : 2;
//	int _b : 5;
//	int _c : 10;
//	int _d : 30;
//};
//struct S
//{
//	char a : 3;
//	char b : 4;
//	char c : 5;
//	char d : 4;
//};
//#include <stdio.h>
//int main()
//{
//	struct S s = { 0 };
//	s.a = 10;
//	s.b = 12;
//	s.c = 3;
//	s.d = 4;
//	printf("%d\n", sizeof(s));
//}
#include <stdio.h>
union
{
	int i;
	char ch;
}un;
int main()
{

	printf("%p\n", &un.ch);
	printf("%p\n", &un.i);

}